package com.xthink.web.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xthink.common.pojo.iPackage.CustomPackageHistory;
import com.xthink.common.vo.iPackage.CustomPackagePageVo;
import com.xthink.common.result.AjaxResult;
import com.xthink.web.mapper.CustomPackageHistoryMapper;
import com.xthink.web.service.CustomPackageHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomPackageHistoryServiceImpl extends ServiceImpl<CustomPackageHistoryMapper, CustomPackageHistory> implements CustomPackageHistoryService {

    @Autowired
    private CustomPackageHistoryMapper customPackageHistoryMapper;

    //分页查询自定义套餐单价历史价格
    @Override
    public AjaxResult listCustomPackagePrice(CustomPackagePageVo customPackagePageVo) {
        Page<CustomPackageHistory> page = new Page<>(customPackagePageVo.getPage(),customPackagePageVo.getSize());
        LambdaQueryWrapper<CustomPackageHistory> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CustomPackageHistory::getPackageId,customPackagePageVo.getId());
        Page<CustomPackageHistory> customPackageHistoryPage = customPackageHistoryMapper.selectPage(page, wrapper);
        List<CustomPackageHistory> customPackageHistory = customPackageHistoryPage.getRecords();

        return AjaxResult.success("查询成功",customPackageHistory);
    }

    //分页查询标准套餐单价历史价格
    @Override
    public AjaxResult listPipPackagePrice(CustomPackagePageVo customPackagePageVo) {
        Page<CustomPackageHistory> page = new Page<>(customPackagePageVo.getPage(),customPackagePageVo.getSize());
        LambdaQueryWrapper<CustomPackageHistory> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CustomPackageHistory::getPackageId,customPackagePageVo.getId());
        Page<CustomPackageHistory> customPackageHistoryPage = customPackageHistoryMapper.selectPage(page, wrapper);
        List<CustomPackageHistory> customPackageHistory = customPackageHistoryPage.getRecords();

        return AjaxResult.success("查询成功",customPackageHistory);
    }
}
